package com.xbongbong.pro.webdetail.pojo;

import com.alibaba.fastjson.JSONObject;
import com.xbongbong.pro.enums.StatisticOptionEnum;
import lombok.Getter;
import lombok.Setter;

import java.util.Objects;

/**
 * 工作报告详情统计
 * @author haibin.zhang
 * @version v1.0
 * @date 2019/2/25 13:52
 * @since v1.0
 */
@Getter
@Setter
public class WorkReportDetailStatisicPojo {
    /**
     * 客户新增数
     */
    private Integer customerAddCount;
    /**
     * 合同新增数
     */
    private Integer contractAddCount;
    /**
     * 合同金额
     */
    private Double contractAmount;
    /**
     * 跟进记录新增数
     */
    private Integer communicateAddCount;
    /**
     * 机会新增数
     */
    private Integer opportunityAddCount;
    /**
     * 机会金额
     */
    private Double oppAmount;
    /**
     * 回款金额
     */
    private Double paymentSheetAmount;
    /**
     * 客户新增数是否开启
     */
    private Integer customerAddCountVisble = 0;
    /**
     * 合同新增数是否开启
     */
    private Integer contractAddCountVisble = 0;
    /**
     * 合同金额是否开启
     */
    private Integer contractAmountVisble = 0;
    /**
     * 跟进记录新增数是否开启
     */
    private Integer communicateAddCountVisble = 0;
    /**
     * 机会新增数是否开启
     */
    private Integer opportunityAddCountVisble = 0;
    /**
     * 机会金额是否开启
     */
    private Integer oppAmountVisble = 0;
    /**
     * 回款金额是否开启
     */
    private Integer paymentSheetAmountVisble = 0;

    public WorkReportDetailStatisicPojo() {
    }

    public void statisticSetFilter(JSONObject statisticOption) {
        if (!Objects.equals(statisticOption.getInteger(StatisticOptionEnum.CONTRACT_ADD_COUNT.getAttr()),0)) {
            this.contractAmountVisble = null;
        }
        if (!Objects.equals(statisticOption.getInteger(StatisticOptionEnum.CUSTOMER_ADD_COUNT.getAttr()),0)) {
            this.customerAddCountVisble = null;
        }
        if (!Objects.equals(statisticOption.getInteger(StatisticOptionEnum.OPPORTUNITY_ADD_COUNT.getAttr()),0)) {
            this.opportunityAddCountVisble = null;
        }
        if (!Objects.equals(statisticOption.getInteger(StatisticOptionEnum.COMMUNICATE_ADD_COUNT.getAttr()),0)) {
            this.communicateAddCountVisble = null;
        }
        if (!Objects.equals(statisticOption.getInteger(StatisticOptionEnum.OPP_AMOUNT.getAttr()),0)) {
            this.oppAmountVisble = null;
        }
        if (!Objects.equals(statisticOption.getInteger(StatisticOptionEnum.PAYMENT_SHEET_AMOUNT.getAttr()),0)) {
            this.paymentSheetAmountVisble = null;
        }
        if (!Objects.equals(statisticOption.getInteger(StatisticOptionEnum.CONTRACT_AMOUNT.getAttr()),0)) {
            this.contractAmountVisble = null;
        }
    }
}
